package com.kzj.mls.recyclerCard.cardView;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.TextView;

import com.alibaba.fastjson.JSON;
import com.kzj.mls.R;
import com.kzj.mls.activity.GBaseActivity;
import com.kzj.mls.beans.BookDateTime;
import com.kzj.mls.beans.TimeBean;
import com.kzj.mls.beans.TimeListBean;
import com.kzj.mls.global.App;
import com.kzj.mls.global.Constant;
import com.kzj.mls.recyclerCard.basic.CardItemView;
import com.kzj.mls.recyclerCard.basic.MaterialListAdapter;
import com.kzj.mls.recyclerCard.basic.MaterialListView;
import com.kzj.mls.recyclerCard.card.other.ChooseLeftTimeCard;
import com.kzj.mls.recyclerCard.card.other.ChooseRightTimeCard;
import com.kzj.mls.request.BaseResponse;
import com.kzj.mls.request.ICallBackForRequestServer;
import com.kzj.mls.request.RequestServerManager;

import de.greenrobot.event.EventBus;

/**
 * Created by xyg on 2015/11/9.
 */
public class ChooseTimeLeftCardView extends CardItemView<ChooseLeftTimeCard> {

    private Context context;
    private TextView textView_time;
    /*private TextView textView_title;*/
    MaterialListView materialListViewDate;
    MaterialListView materialListViewTime;
    public ChooseTimeLeftCardView(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
    }

    public ChooseTimeLeftCardView(Context context) {
        super(context);
        this.context = context;
    }

    public ChooseTimeLeftCardView(Context context, AttributeSet attrs) {
        super(context, attrs);
        this.context = context;
    }

    @Override
    public void build(final ChooseLeftTimeCard card) {
        super.build(card);
        textView_time = (TextView) findViewById(R.id.textView_time);
        textView_time.setText(card.getScheduleBean().getDate_format()+card.getScheduleBean().getDate_lang());

        //先判断booktime
        if (card.isSelected())
        {
            textView_time.setBackgroundColor(getResources().getColor(R.color.color_f875a3_red));
        }else
        {
            textView_time.setBackgroundColor(getResources().getColor(R.color.white));
        }
       /* if (card.isSelected()) {
            textView_time.setBackgroundColor(getResources().getColor(R.color.color_f875a3_red));
        }else
        {
            textView_time.setBackgroundColor(getResources().getColor(R.color.white));
        }*/
        textView_time.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {





                EventBus.getDefault().post(card);
               // TaskGetTimeList(App.getInstance().getLongitude(), App.getInstance().getLatitude(), card.getSid(),App.getInstance().getCity(), card.getTimeBean().getTime());
                /*for (int i = 0; i < 10; i++) {
                    ChooseRightTimeCard chooseRightTimeCard = new ChooseRightTimeCard(context);
                    TimeBean timeBean = new TimeBean();
                    timeBean.setTime(i + "-");
                    chooseRightTimeCard.setTimeBean(timeBean);
                    materialListViewTime.add(chooseRightTimeCard);
                }*/
            }
        });
    }


}
